package edu.maplef.bookwild.utils;

import org.junit.Test;

import com.google.gdata.client.douban.DoubanService;
import com.google.gdata.data.douban.SubjectEntry;

import edu.maplef.bookwild.dao.impl.jdo.BookDaoJDOImpl;
import edu.maplef.bookwild.schema.Book;

public class DoubanServiceUtilTest {

	private DoubanService dbs = null;
	private BookDaoJDOImpl bd = new BookDaoJDOImpl();

	@Test
	public void Test() {
		try {
			TestDoubanServicePool();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public void TestDoubanServicePool() throws Exception {
		dbs = DoubanServiceUtil.getDoubanService();
		SubjectEntry entity = dbs.getBook(1123456);
		Book b = bd.entry2Book(entity);
		System.out.println(b);
		dbs = DoubanServiceUtil.getDoubanService();
		SubjectEntry entity2 = dbs.getBook(1123456);
		b = bd.entry2Book(entity2);
		System.out.println(b);
		dbs = DoubanServiceUtil.getDoubanService();
		SubjectEntry entity3 = dbs.getBook(1123456);
		b = bd.entry2Book(entity3);
		System.out.println(b);
		dbs = DoubanServiceUtil.getDoubanService();
		SubjectEntry entity4 = dbs.getBook(1123456);
		b = bd.entry2Book(entity4);
		System.out.println(b);
	}
}
